<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/12/20/020
 * Time: 18:01
 */

namespace app\portal\controller;


use cmf\controller\HomeBaseController;
use think\Db;
use think\Loader;

class ApplyController extends HomeBaseController
{
    //申请说明的提交
    public function getPostData()
    {
        $data = [];
        !is_null(input('post.country')) && $data['country'] = input('post.country');
        !is_null(input('post.province')) && $data['province'] = input('post.province');
        !is_null(input('post.city')) && $data['city'] = input('post.city');
        !is_null(input('post.name')) && $data['name'] = input('post.name');
        !is_null(input('post.mobile')) && $data['mobile'] = input('post.mobile');
        !is_null(input('post.content')) && $data['content'] = htmlspecialchars(input('post.content'));
        $validate = Loader::validate('Liuyan');
        if(!$validate->check($data)){
            $this->error( $validate->getError());
        }
        $data['create_time'] = time();
        $result = Db::name('Liuyan')->insert($data);
        if ( $result ){
          $this->success("申请说明已提交",url('/portal/club/league'));
        }
    }
}